/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
"use strict";

var $protobuf = require("protobufjs");

// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;

// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});

$root.game = (function() {

    /**
     * Namespace game.
     * @exports game
     * @namespace
     */
    var game = {};

    game.RefTest = (function() {

        /**
         * Properties of a RefTest.
         * @memberof game
         * @interface IRefTest
         * @property {number|null} [value] RefTest value
         */

        /**
         * Constructs a new RefTest.
         * @memberof game
         * @classdesc Represents a RefTest.
         * @implements IRefTest
         * @constructor
         * @param {game.IRefTest=} [properties] Properties to set
         */
        function RefTest(properties) {
            if (properties)
                for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                    if (properties[keys[i]] != null)
                        this[keys[i]] = properties[keys[i]];
        }

        /**
         * RefTest value.
         * @member {number} value
         * @memberof game.RefTest
         * @instance
         */
        RefTest.prototype.value = 0;

        /**
         * Creates a new RefTest instance using the specified properties.
         * @function create
         * @memberof game.RefTest
         * @static
         * @param {game.IRefTest=} [properties] Properties to set
         * @returns {game.RefTest} RefTest instance
         */
        RefTest.create = function create(properties) {
            return new RefTest(properties);
        };

        /**
         * Encodes the specified RefTest message. Does not implicitly {@link game.RefTest.verify|verify} messages.
         * @function encode
         * @memberof game.RefTest
         * @static
         * @param {game.IRefTest} message RefTest message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        RefTest.encode = function encode(message, writer) {
            if (!writer)
                writer = $Writer.create();
            if (message.value != null && Object.hasOwnProperty.call(message, "value"))
                writer.uint32(/* id 2, wireType 0 =*/16).int32(message.value);
            return writer;
        };

        /**
         * Encodes the specified RefTest message, length delimited. Does not implicitly {@link game.RefTest.verify|verify} messages.
         * @function encodeDelimited
         * @memberof game.RefTest
         * @static
         * @param {game.IRefTest} message RefTest message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        RefTest.encodeDelimited = function encodeDelimited(message, writer) {
            return this.encode(message, writer).ldelim();
        };

        /**
         * Decodes a RefTest message from the specified reader or buffer.
         * @function decode
         * @memberof game.RefTest
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @param {number} [length] Message length if known beforehand
         * @returns {game.RefTest} RefTest
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        RefTest.decode = function decode(reader, length) {
            if (!(reader instanceof $Reader))
                reader = $Reader.create(reader);
            var end = length === undefined ? reader.len : reader.pos + length, message = new $root.game.RefTest();
            while (reader.pos < end) {
                var tag = reader.uint32();
                switch (tag >>> 3) {
                case 2:
                    message.value = reader.int32();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
                }
            }
            return message;
        };

        /**
         * Decodes a RefTest message from the specified reader or buffer, length delimited.
         * @function decodeDelimited
         * @memberof game.RefTest
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @returns {game.RefTest} RefTest
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        RefTest.decodeDelimited = function decodeDelimited(reader) {
            if (!(reader instanceof $Reader))
                reader = new $Reader(reader);
            return this.decode(reader, reader.uint32());
        };

        /**
         * Verifies a RefTest message.
         * @function verify
         * @memberof game.RefTest
         * @static
         * @param {Object.<string,*>} message Plain object to verify
         * @returns {string|null} `null` if valid, otherwise the reason why it is not
         */
        RefTest.verify = function verify(message) {
            if (typeof message !== "object" || message === null)
                return "object expected";
            if (message.value != null && message.hasOwnProperty("value"))
                if (!$util.isInteger(message.value))
                    return "value: integer expected";
            return null;
        };

        /**
         * Creates a RefTest message from a plain object. Also converts values to their respective internal types.
         * @function fromObject
         * @memberof game.RefTest
         * @static
         * @param {Object.<string,*>} object Plain object
         * @returns {game.RefTest} RefTest
         */
        RefTest.fromObject = function fromObject(object) {
            if (object instanceof $root.game.RefTest)
                return object;
            var message = new $root.game.RefTest();
            if (object.value != null)
                message.value = object.value | 0;
            return message;
        };

        /**
         * Creates a plain object from a RefTest message. Also converts values to other types if specified.
         * @function toObject
         * @memberof game.RefTest
         * @static
         * @param {game.RefTest} message RefTest
         * @param {$protobuf.IConversionOptions} [options] Conversion options
         * @returns {Object.<string,*>} Plain object
         */
        RefTest.toObject = function toObject(message, options) {
            if (!options)
                options = {};
            var object = {};
            if (options.defaults)
                object.value = 0;
            if (message.value != null && message.hasOwnProperty("value"))
                object.value = message.value;
            return object;
        };

        /**
         * Converts this RefTest to JSON.
         * @function toJSON
         * @memberof game.RefTest
         * @instance
         * @returns {Object.<string,*>} JSON object
         */
        RefTest.prototype.toJSON = function toJSON() {
            return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
        };

        return RefTest;
    })();

    game.ExtendTest = (function() {

        /**
         * Properties of an ExtendTest.
         * @memberof game
         * @interface IExtendTest
         * @property {game.IRefTest|null} [_Super] ExtendTest _Super
         * @property {string|null} [parent] ExtendTest parent
         */

        /**
         * Constructs a new ExtendTest.
         * @memberof game
         * @classdesc Represents an ExtendTest.
         * @implements IExtendTest
         * @constructor
         * @param {game.IExtendTest=} [properties] Properties to set
         */
        function ExtendTest(properties) {
            if (properties)
                for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                    if (properties[keys[i]] != null)
                        this[keys[i]] = properties[keys[i]];
        }

        /**
         * ExtendTest _Super.
         * @member {game.IRefTest|null|undefined} _Super
         * @memberof game.ExtendTest
         * @instance
         */
        ExtendTest.prototype._Super = null;

        /**
         * ExtendTest parent.
         * @member {string} parent
         * @memberof game.ExtendTest
         * @instance
         */
        ExtendTest.prototype.parent = "";

        /**
         * Creates a new ExtendTest instance using the specified properties.
         * @function create
         * @memberof game.ExtendTest
         * @static
         * @param {game.IExtendTest=} [properties] Properties to set
         * @returns {game.ExtendTest} ExtendTest instance
         */
        ExtendTest.create = function create(properties) {
            return new ExtendTest(properties);
        };

        /**
         * Encodes the specified ExtendTest message. Does not implicitly {@link game.ExtendTest.verify|verify} messages.
         * @function encode
         * @memberof game.ExtendTest
         * @static
         * @param {game.IExtendTest} message ExtendTest message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        ExtendTest.encode = function encode(message, writer) {
            if (!writer)
                writer = $Writer.create();
            if (message._Super != null && Object.hasOwnProperty.call(message, "_Super"))
                $root.game.RefTest.encode(message._Super, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
            if (message.parent != null && Object.hasOwnProperty.call(message, "parent"))
                writer.uint32(/* id 2, wireType 2 =*/18).string(message.parent);
            return writer;
        };

        /**
         * Encodes the specified ExtendTest message, length delimited. Does not implicitly {@link game.ExtendTest.verify|verify} messages.
         * @function encodeDelimited
         * @memberof game.ExtendTest
         * @static
         * @param {game.IExtendTest} message ExtendTest message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        ExtendTest.encodeDelimited = function encodeDelimited(message, writer) {
            return this.encode(message, writer).ldelim();
        };

        /**
         * Decodes an ExtendTest message from the specified reader or buffer.
         * @function decode
         * @memberof game.ExtendTest
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @param {number} [length] Message length if known beforehand
         * @returns {game.ExtendTest} ExtendTest
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        ExtendTest.decode = function decode(reader, length) {
            if (!(reader instanceof $Reader))
                reader = $Reader.create(reader);
            var end = length === undefined ? reader.len : reader.pos + length, message = new $root.game.ExtendTest();
            while (reader.pos < end) {
                var tag = reader.uint32();
                switch (tag >>> 3) {
                case 1:
                    message._Super = $root.game.RefTest.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.parent = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
                }
            }
            return message;
        };

        /**
         * Decodes an ExtendTest message from the specified reader or buffer, length delimited.
         * @function decodeDelimited
         * @memberof game.ExtendTest
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @returns {game.ExtendTest} ExtendTest
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        ExtendTest.decodeDelimited = function decodeDelimited(reader) {
            if (!(reader instanceof $Reader))
                reader = new $Reader(reader);
            return this.decode(reader, reader.uint32());
        };

        /**
         * Verifies an ExtendTest message.
         * @function verify
         * @memberof game.ExtendTest
         * @static
         * @param {Object.<string,*>} message Plain object to verify
         * @returns {string|null} `null` if valid, otherwise the reason why it is not
         */
        ExtendTest.verify = function verify(message) {
            if (typeof message !== "object" || message === null)
                return "object expected";
            if (message._Super != null && message.hasOwnProperty("_Super")) {
                var error = $root.game.RefTest.verify(message._Super);
                if (error)
                    return "_Super." + error;
            }
            if (message.parent != null && message.hasOwnProperty("parent"))
                if (!$util.isString(message.parent))
                    return "parent: string expected";
            return null;
        };

        /**
         * Creates an ExtendTest message from a plain object. Also converts values to their respective internal types.
         * @function fromObject
         * @memberof game.ExtendTest
         * @static
         * @param {Object.<string,*>} object Plain object
         * @returns {game.ExtendTest} ExtendTest
         */
        ExtendTest.fromObject = function fromObject(object) {
            if (object instanceof $root.game.ExtendTest)
                return object;
            var message = new $root.game.ExtendTest();
            if (object._Super != null) {
                if (typeof object._Super !== "object")
                    throw TypeError(".game.ExtendTest._Super: object expected");
                message._Super = $root.game.RefTest.fromObject(object._Super);
            }
            if (object.parent != null)
                message.parent = String(object.parent);
            return message;
        };

        /**
         * Creates a plain object from an ExtendTest message. Also converts values to other types if specified.
         * @function toObject
         * @memberof game.ExtendTest
         * @static
         * @param {game.ExtendTest} message ExtendTest
         * @param {$protobuf.IConversionOptions} [options] Conversion options
         * @returns {Object.<string,*>} Plain object
         */
        ExtendTest.toObject = function toObject(message, options) {
            if (!options)
                options = {};
            var object = {};
            if (options.defaults) {
                object._Super = null;
                object.parent = "";
            }
            if (message._Super != null && message.hasOwnProperty("_Super"))
                object._Super = $root.game.RefTest.toObject(message._Super, options);
            if (message.parent != null && message.hasOwnProperty("parent"))
                object.parent = message.parent;
            return object;
        };

        /**
         * Converts this ExtendTest to JSON.
         * @function toJSON
         * @memberof game.ExtendTest
         * @instance
         * @returns {Object.<string,*>} JSON object
         */
        ExtendTest.prototype.toJSON = function toJSON() {
            return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
        };

        return ExtendTest;
    })();

    game.ProtoTest = (function() {

        /**
         * Properties of a ProtoTest.
         * @memberof game
         * @interface IProtoTest
         * @property {game.IExtendTest|null} [_Super] ProtoTest _Super
         * @property {string|null} [from] ProtoTest from
         * @property {number|null} [version] ProtoTest version
         * @property {boolean|null} [isClient] ProtoTest isClient
         * @property {boolean|null} [isServer] ProtoTest isServer
         * @property {game.IRefTest|null} [ref] ProtoTest ref
         * @property {Array.<number>|null} [enumList] ProtoTest enumList
         * @property {Object.<string,number>|null} [enumMap] ProtoTest enumMap
         */

        /**
         * Constructs a new ProtoTest.
         * @memberof game
         * @classdesc Represents a ProtoTest.
         * @implements IProtoTest
         * @constructor
         * @param {game.IProtoTest=} [properties] Properties to set
         */
        function ProtoTest(properties) {
            this.enumList = [];
            this.enumMap = {};
            if (properties)
                for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                    if (properties[keys[i]] != null)
                        this[keys[i]] = properties[keys[i]];
        }

        /**
         * ProtoTest _Super.
         * @member {game.IExtendTest|null|undefined} _Super
         * @memberof game.ProtoTest
         * @instance
         */
        ProtoTest.prototype._Super = null;

        /**
         * ProtoTest from.
         * @member {string} from
         * @memberof game.ProtoTest
         * @instance
         */
        ProtoTest.prototype.from = "";

        /**
         * ProtoTest version.
         * @member {number} version
         * @memberof game.ProtoTest
         * @instance
         */
        ProtoTest.prototype.version = 0;

        /**
         * ProtoTest isClient.
         * @member {boolean} isClient
         * @memberof game.ProtoTest
         * @instance
         */
        ProtoTest.prototype.isClient = false;

        /**
         * ProtoTest isServer.
         * @member {boolean} isServer
         * @memberof game.ProtoTest
         * @instance
         */
        ProtoTest.prototype.isServer = false;

        /**
         * ProtoTest ref.
         * @member {game.IRefTest|null|undefined} ref
         * @memberof game.ProtoTest
         * @instance
         */
        ProtoTest.prototype.ref = null;

        /**
         * ProtoTest enumList.
         * @member {Array.<number>} enumList
         * @memberof game.ProtoTest
         * @instance
         */
        ProtoTest.prototype.enumList = $util.emptyArray;

        /**
         * ProtoTest enumMap.
         * @member {Object.<string,number>} enumMap
         * @memberof game.ProtoTest
         * @instance
         */
        ProtoTest.prototype.enumMap = $util.emptyObject;

        /**
         * Creates a new ProtoTest instance using the specified properties.
         * @function create
         * @memberof game.ProtoTest
         * @static
         * @param {game.IProtoTest=} [properties] Properties to set
         * @returns {game.ProtoTest} ProtoTest instance
         */
        ProtoTest.create = function create(properties) {
            return new ProtoTest(properties);
        };

        /**
         * Encodes the specified ProtoTest message. Does not implicitly {@link game.ProtoTest.verify|verify} messages.
         * @function encode
         * @memberof game.ProtoTest
         * @static
         * @param {game.IProtoTest} message ProtoTest message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        ProtoTest.encode = function encode(message, writer) {
            if (!writer)
                writer = $Writer.create();
            if (message._Super != null && Object.hasOwnProperty.call(message, "_Super"))
                $root.game.ExtendTest.encode(message._Super, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
            if (message.from != null && Object.hasOwnProperty.call(message, "from"))
                writer.uint32(/* id 2, wireType 2 =*/18).string(message.from);
            if (message.version != null && Object.hasOwnProperty.call(message, "version"))
                writer.uint32(/* id 3, wireType 0 =*/24).int32(message.version);
            if (message.isClient != null && Object.hasOwnProperty.call(message, "isClient"))
                writer.uint32(/* id 4, wireType 0 =*/32).bool(message.isClient);
            if (message.isServer != null && Object.hasOwnProperty.call(message, "isServer"))
                writer.uint32(/* id 5, wireType 0 =*/40).bool(message.isServer);
            if (message.ref != null && Object.hasOwnProperty.call(message, "ref"))
                $root.game.RefTest.encode(message.ref, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
            if (message.enumList != null && message.enumList.length) {
                writer.uint32(/* id 7, wireType 2 =*/58).fork();
                for (var i = 0; i < message.enumList.length; ++i)
                    writer.int32(message.enumList[i]);
                writer.ldelim();
            }
            if (message.enumMap != null && Object.hasOwnProperty.call(message, "enumMap"))
                for (var keys = Object.keys(message.enumMap), i = 0; i < keys.length; ++i)
                    writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 0 =*/16).int32(message.enumMap[keys[i]]).ldelim();
            return writer;
        };

        /**
         * Encodes the specified ProtoTest message, length delimited. Does not implicitly {@link game.ProtoTest.verify|verify} messages.
         * @function encodeDelimited
         * @memberof game.ProtoTest
         * @static
         * @param {game.IProtoTest} message ProtoTest message or plain object to encode
         * @param {$protobuf.Writer} [writer] Writer to encode to
         * @returns {$protobuf.Writer} Writer
         */
        ProtoTest.encodeDelimited = function encodeDelimited(message, writer) {
            return this.encode(message, writer).ldelim();
        };

        /**
         * Decodes a ProtoTest message from the specified reader or buffer.
         * @function decode
         * @memberof game.ProtoTest
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @param {number} [length] Message length if known beforehand
         * @returns {game.ProtoTest} ProtoTest
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        ProtoTest.decode = function decode(reader, length) {
            if (!(reader instanceof $Reader))
                reader = $Reader.create(reader);
            var end = length === undefined ? reader.len : reader.pos + length, message = new $root.game.ProtoTest(), key, value;
            while (reader.pos < end) {
                var tag = reader.uint32();
                switch (tag >>> 3) {
                case 1:
                    message._Super = $root.game.ExtendTest.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.from = reader.string();
                    break;
                case 3:
                    message.version = reader.int32();
                    break;
                case 4:
                    message.isClient = reader.bool();
                    break;
                case 5:
                    message.isServer = reader.bool();
                    break;
                case 6:
                    message.ref = $root.game.RefTest.decode(reader, reader.uint32());
                    break;
                case 7:
                    if (!(message.enumList && message.enumList.length))
                        message.enumList = [];
                    if ((tag & 7) === 2) {
                        var end2 = reader.uint32() + reader.pos;
                        while (reader.pos < end2)
                            message.enumList.push(reader.int32());
                    } else
                        message.enumList.push(reader.int32());
                    break;
                case 8:
                    if (message.enumMap === $util.emptyObject)
                        message.enumMap = {};
                    var end2 = reader.uint32() + reader.pos;
                    key = "";
                    value = 0;
                    while (reader.pos < end2) {
                        var tag2 = reader.uint32();
                        switch (tag2 >>> 3) {
                        case 1:
                            key = reader.string();
                            break;
                        case 2:
                            value = reader.int32();
                            break;
                        default:
                            reader.skipType(tag2 & 7);
                            break;
                        }
                    }
                    message.enumMap[key] = value;
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
                }
            }
            return message;
        };

        /**
         * Decodes a ProtoTest message from the specified reader or buffer, length delimited.
         * @function decodeDelimited
         * @memberof game.ProtoTest
         * @static
         * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
         * @returns {game.ProtoTest} ProtoTest
         * @throws {Error} If the payload is not a reader or valid buffer
         * @throws {$protobuf.util.ProtocolError} If required fields are missing
         */
        ProtoTest.decodeDelimited = function decodeDelimited(reader) {
            if (!(reader instanceof $Reader))
                reader = new $Reader(reader);
            return this.decode(reader, reader.uint32());
        };

        /**
         * Verifies a ProtoTest message.
         * @function verify
         * @memberof game.ProtoTest
         * @static
         * @param {Object.<string,*>} message Plain object to verify
         * @returns {string|null} `null` if valid, otherwise the reason why it is not
         */
        ProtoTest.verify = function verify(message) {
            if (typeof message !== "object" || message === null)
                return "object expected";
            if (message._Super != null && message.hasOwnProperty("_Super")) {
                var error = $root.game.ExtendTest.verify(message._Super);
                if (error)
                    return "_Super." + error;
            }
            if (message.from != null && message.hasOwnProperty("from"))
                if (!$util.isString(message.from))
                    return "from: string expected";
            if (message.version != null && message.hasOwnProperty("version"))
                if (!$util.isInteger(message.version))
                    return "version: integer expected";
            if (message.isClient != null && message.hasOwnProperty("isClient"))
                if (typeof message.isClient !== "boolean")
                    return "isClient: boolean expected";
            if (message.isServer != null && message.hasOwnProperty("isServer"))
                if (typeof message.isServer !== "boolean")
                    return "isServer: boolean expected";
            if (message.ref != null && message.hasOwnProperty("ref")) {
                var error = $root.game.RefTest.verify(message.ref);
                if (error)
                    return "ref." + error;
            }
            if (message.enumList != null && message.hasOwnProperty("enumList")) {
                if (!Array.isArray(message.enumList))
                    return "enumList: array expected";
                for (var i = 0; i < message.enumList.length; ++i)
                    if (!$util.isInteger(message.enumList[i]))
                        return "enumList: integer[] expected";
            }
            if (message.enumMap != null && message.hasOwnProperty("enumMap")) {
                if (!$util.isObject(message.enumMap))
                    return "enumMap: object expected";
                var key = Object.keys(message.enumMap);
                for (var i = 0; i < key.length; ++i)
                    if (!$util.isInteger(message.enumMap[key[i]]))
                        return "enumMap: integer{k:string} expected";
            }
            return null;
        };

        /**
         * Creates a ProtoTest message from a plain object. Also converts values to their respective internal types.
         * @function fromObject
         * @memberof game.ProtoTest
         * @static
         * @param {Object.<string,*>} object Plain object
         * @returns {game.ProtoTest} ProtoTest
         */
        ProtoTest.fromObject = function fromObject(object) {
            if (object instanceof $root.game.ProtoTest)
                return object;
            var message = new $root.game.ProtoTest();
            if (object._Super != null) {
                if (typeof object._Super !== "object")
                    throw TypeError(".game.ProtoTest._Super: object expected");
                message._Super = $root.game.ExtendTest.fromObject(object._Super);
            }
            if (object.from != null)
                message.from = String(object.from);
            if (object.version != null)
                message.version = object.version | 0;
            if (object.isClient != null)
                message.isClient = Boolean(object.isClient);
            if (object.isServer != null)
                message.isServer = Boolean(object.isServer);
            if (object.ref != null) {
                if (typeof object.ref !== "object")
                    throw TypeError(".game.ProtoTest.ref: object expected");
                message.ref = $root.game.RefTest.fromObject(object.ref);
            }
            if (object.enumList) {
                if (!Array.isArray(object.enumList))
                    throw TypeError(".game.ProtoTest.enumList: array expected");
                message.enumList = [];
                for (var i = 0; i < object.enumList.length; ++i)
                    message.enumList[i] = object.enumList[i] | 0;
            }
            if (object.enumMap) {
                if (typeof object.enumMap !== "object")
                    throw TypeError(".game.ProtoTest.enumMap: object expected");
                message.enumMap = {};
                for (var keys = Object.keys(object.enumMap), i = 0; i < keys.length; ++i)
                    message.enumMap[keys[i]] = object.enumMap[keys[i]] | 0;
            }
            return message;
        };

        /**
         * Creates a plain object from a ProtoTest message. Also converts values to other types if specified.
         * @function toObject
         * @memberof game.ProtoTest
         * @static
         * @param {game.ProtoTest} message ProtoTest
         * @param {$protobuf.IConversionOptions} [options] Conversion options
         * @returns {Object.<string,*>} Plain object
         */
        ProtoTest.toObject = function toObject(message, options) {
            if (!options)
                options = {};
            var object = {};
            if (options.arrays || options.defaults)
                object.enumList = [];
            if (options.objects || options.defaults)
                object.enumMap = {};
            if (options.defaults) {
                object._Super = null;
                object.from = "";
                object.version = 0;
                object.isClient = false;
                object.isServer = false;
                object.ref = null;
            }
            if (message._Super != null && message.hasOwnProperty("_Super"))
                object._Super = $root.game.ExtendTest.toObject(message._Super, options);
            if (message.from != null && message.hasOwnProperty("from"))
                object.from = message.from;
            if (message.version != null && message.hasOwnProperty("version"))
                object.version = message.version;
            if (message.isClient != null && message.hasOwnProperty("isClient"))
                object.isClient = message.isClient;
            if (message.isServer != null && message.hasOwnProperty("isServer"))
                object.isServer = message.isServer;
            if (message.ref != null && message.hasOwnProperty("ref"))
                object.ref = $root.game.RefTest.toObject(message.ref, options);
            if (message.enumList && message.enumList.length) {
                object.enumList = [];
                for (var j = 0; j < message.enumList.length; ++j)
                    object.enumList[j] = message.enumList[j];
            }
            var keys2;
            if (message.enumMap && (keys2 = Object.keys(message.enumMap)).length) {
                object.enumMap = {};
                for (var j = 0; j < keys2.length; ++j)
                    object.enumMap[keys2[j]] = message.enumMap[keys2[j]];
            }
            return object;
        };

        /**
         * Converts this ProtoTest to JSON.
         * @function toJSON
         * @memberof game.ProtoTest
         * @instance
         * @returns {Object.<string,*>} JSON object
         */
        ProtoTest.prototype.toJSON = function toJSON() {
            return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
        };

        return ProtoTest;
    })();

    return game;
})();

module.exports = $root;
